package org.ttjhome.db;

import javax.persistence.EntityManager;

public final   class DbThreadLocal {
	
	private static DbThreadLocal instance;

	private  DbThreadLocal() {
		
	}
	private ThreadLocal<EntityManager>  threadsBlackboard =  new ThreadLocal<EntityManager>();
	
    public void setThreadsBlackboard(EntityManager entityManager) {
        threadsBlackboard.set(entityManager);
    }
    
    public EntityManager getThreadsBlackboard() {
        return threadsBlackboard.get();
    }
    
    public static DbThreadLocal getInstance(){
    	if(instance==null){
    		instance =  new DbThreadLocal();
    	}
    	return  instance;
    }
}
